Skip to content

Surface streamable HTTP connection errors#2711

Open
FU-max-boop wants to merge 2 commits into
modelcontextprotocol:mainfrom
FU-max-boop:fix/streamable-connect-errors
Open

Surface streamable HTTP connection errors#2711
FU-max-boop wants to merge 2 commits into
modelcontextprotocol:mainfrom
FU-max-boop:fix/streamable-connect-errors

Conversation

@FU-max-boop
Copy link
Copy Markdown

Fixes #915.\n\n## Summary\n- convert background streamable HTTP request failures into JSON-RPC errors for the originating request\n- prevents ClientSessionGroup initialization from hanging or surfacing async generator cleanup errors when the remote streamable HTTP server is unavailable\n- add a regression test that uses a failing httpx transport and asserts connect_to_server returns a catchable MCPError\n\n## Validation\n- uv run pytest tests/client/test_session_group.py -q\n- uv run pytest tests/client/test_session_group.py -q -k streamable_http_connection_error_surfaces\n- uv run ruff check src/mcp/client/streamable_http.py tests/client/test_session_group.py\n- uv run ruff format --check src/mcp/client/streamable_http.py tests/client/test_session_group.py\n- uv run pyright src/mcp/client/streamable_http.py tests/client/test_session_group.py\n- git diff --check\n\nNote: I also tried the existing tests/client/test_transport_stream_cleanup.py locally; an unrelated environment/proxy behavior returned 502 for a free localhost port where that test expects ConnectError, so I kept the validation above focused on this change path.

@FU-max-boop FU-max-boop force-pushed the fix/streamable-connect-errors branch 4 times, most recently from 401bd5e to fd1d142 Compare May 29, 2026 03:10
@FU-max-boop FU-max-boop force-pushed the fix/streamable-connect-errors branch from fd1d142 to b3cb4d8 Compare May 29, 2026 03:15
@FU-max-boop
Copy link
Copy Markdown
Author

Thanks for the CI signal here. I pushed a follow-up that fixes the Python 3.14 branch-coverage miss in the new connection-error test.\n\nThe latest run now has only one red job left: . Its log shows the test suite passed, but coverage missed the subprocess helper on that Windows matrix (, fail-under 100). That file is outside this PR's diff, and the other Python 3.14 jobs now pass.\n\nI tried to rerun the failed job, but GitHub rejected it because I do not have admin rights on the repo.

@FU-max-boop
Copy link
Copy Markdown
Author

Thanks for the CI signal here. I pushed a follow-up that fixes the Python 3.14 branch-coverage miss in the new connection-error test.

The latest run now has only one red job left: checks / test (3.14, locked, windows-latest). Its log shows the test suite passed, but coverage missed the subprocess helper tests/interaction/transports/_stdio_server.py on that Windows matrix (TOTAL 99.96%, fail-under 100). That file is outside this PR's diff, and the other Python 3.14 jobs now pass.

I tried to rerun the failed job, but GitHub rejected it because I do not have admin rights on the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception in ClientSessionGroup if streamable_http MCP server is not available

1 participant